<!doctype html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>NodeCMS登录页面</title>
    <link rel="stylesheet" href="/css/admin/reset.css">
    <link rel="stylesheet" href="/css/admin/login.css">
</head>
<body>
    <div class="main">
        <div class="container">
            <h1>welcome to NodeCMS</h1>
            <div class="login-input-box">
                <input type="text" id="username" placeholder="用户名" autocomplete="off">
                <input type="password" id="passwd" placeholder="密码" autocomplete="off">
                <a href="javascript:;" class="btn" id="loginBtn">登录</a>
            </div>
        </div>
    </div>
    <script src="/js/jquery.min.js"></script>
    <script>
        $(function(){
            $('#loginBtn').on('click', function(){
                var userName = $('#username').val();
                var passwd = $('#passwd').val();
                $.ajax({
                    url: '/cms/getLogin',
                    type: 'post',
                    data: {
                        username:userName,
                        passwd:passwd
                    },
                    success: function(d){
                        if(d.code == 200){
                            window.location.href = '/admin/';
                        }else{
                            alert(d.msg);
                        }
                    }
                })
            })
        })
    </script>
</body>
</html>